/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kimstore.gui.repair;

import com.kimstore.gui.sales.*;
import com.kimstore.bean.Item;
import com.kimstore.bean.Product;
import com.kimstore.factory.DaoFactory;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Administrator
 */
public class SelectItemToRepairController {

    private List<Item> items;
    private SelectItemToRepairWindow selectItemWindow;
    private AddItemForRepairController parentController;

    public SelectItemToRepairController(AddItemForRepairController parentController) {
        this.parentController = parentController;
    }

    public void displayWindow() {
        this.items = DaoFactory.getInstance().getItemDao().getAllSoldItems();

        selectItemWindow = new SelectItemToRepairWindow(this);
        selectItemWindow.populateTable(items);
        selectItemWindow.showWindow();
    }

    public void fromWindow(String sku) {
        parentController.createNewSelectItemToRepairControllerCallback(DaoFactory.getInstance().getItemDao().findBySerial(sku));
    }
}
